

<%@page import="carsa.member.PasswordMismatchException"%>
<%@page import="carsa.member.UserNotFoundException"%>
<%@page import="carsa.member.MemberService"%>
<%@page import="carsa.member.Member"%>
<%@ page language="java" contentType="text/html; charset=EUC-KR"
	pageEncoding="EUC-KR"%>
<%
	if (request.getMethod().equalsIgnoreCase("GET")) {
		response.sendRedirect("Member_login.jsp");
		return;
	}
	String id = request.getParameter("id");
	String pass = request.getParameter("pass");

	try {
		Member user=MemberService.getInstance().login(id, pass);
		session.setAttribute("sid", user.getId());
		session.setAttribute("suser", user);
		response.sendRedirect("../common/index.jsp");
	} catch (UserNotFoundException e) {
	    request.setAttribute("msg", e.getMessage());
	    request.setAttribute("fuser", new Member(id,pass,"","","",null,"",null));
		RequestDispatcher rd=
			request.getRequestDispatcher("Member_login.jsp");
		rd.forward(request, response);
		
	} catch (PasswordMismatchException e) {
		request.setAttribute("msg", e.getMessage());
	    request.setAttribute("fuser", new Member(id,pass,"","","",null,"",null));
		RequestDispatcher rd=
				request.getRequestDispatcher("Member_login.jsp");
		rd.forward(request, response);
		
	} catch (Exception e) {
		RequestDispatcher rd=
				request.getRequestDispatcher("error/error.jsp");
			rd.forward(request, response);
	}
%>







